﻿using System.Collections.Generic;


namespace DataModel
{
    public class BoundaryBean
    {
        private double minZ = double.MaxValue, maxZ = double.Epsilon;
        private double sumY = 0;
        private ISet<XYZ> xyzSet = new HashSet<XYZ>();

        public virtual void addXYZ(XYZ xyz)
        {
            if (xyz.z < minZ)
            {
                minZ = xyz.z;
            }
            if (xyz.z > maxZ)
            {
                maxZ = xyz.z;
            }
            xyzSet.Add(xyz);
            sumY += xyz.y;
        }

        public virtual double MinZ
        {
            get
            {
                return minZ;
            }
        }

        public virtual double MaxZ
        {
            get
            {
                return maxZ;
            }
        }

        public virtual ISet<XYZ> XyzSet
        {
            get
            {
                return xyzSet;
            }
        }

        public virtual double LayerHeight
        {
            get
            {
                return maxZ - minZ;
            }
        }

        public virtual double AverageY
        {
            get
            {
                return sumY / xyzSet.Count;
            }
        }
    }
}
